import request from '@/utils/request'

// 获取权限列表
export const getPermissionList = (query) => {
  return request({
    url: `/permissions?_limit=${query.limit}&_start=${query.offset}`,
    method: 'get'
  })
}

export const getPermissionCount = () => {
  return request({
    url: '/permissions/count'
  })
}
// 获取指定权限
export const getPermissionsById = (id) => {
  return request({
    url: '/permissions/' + id,
    method: 'get'
  })
}

// 新增权限
export const addPermission = (data) => {
  return request({
    url: '/permissions',
    method: 'post',
    data
  })
}

// 编辑权限
export const editPermission = (data) => {
  return request({
    url: `/permissions/${data.id}`,
    method: 'PUT',
    data
  })
}

// 删除权限
export const deletePermission = (id) => {
  return request({
    url: `/permissions/${id}`,
    method: 'DELETE'
  })
}
